<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<!--管理员查看商家商品-->
<body>
<table id="dataTable">
    <thead>
    <th></th>
    <th>图片</th>
    <th>商品</th>
    <th>价格</th>
    <th>库存</th>
    </thead>
    <tbody>
    <tr th:each="good : ${goods}">
        <td> <img style="width:700px;height:500px"
                th:src="@{'/photo/'+${good.avatar}}">
        </td>
        <td th:text="${good.goodsName}"></td>
        <td th:text="${good.goodsPrice}"></td>
        <td th:text="${good.number}"></td>
        <td>
            <a @click="forceDelete" th:href="@{'/forceDelete/'+${good.goodsId}}">强制下架</a>
        </td>
    </tr>
</table>
<form id="deleteForm" method="post">
    <input type="hidden" name="_method" value="delete">
</form>
<script type="text/javascript" th:src="@{/static/js/vue.js}"></script>
<script type="text/javascript">

    var vue = new Vue({
        el:"#dataTable",
        methods:{
            forceDelete:function (event) {
                var deleteForm = document.getElementById("deleteForm");
                deleteForm.action = event.target.href;
                deleteForm.submit();
                event.preventDefault();
            }
        }
    });
</script>
</body>
</html>